package addEmployeeTransaction;

import main.Transaction;
import methods.HoldMethod;
import methods.PaymentMethod;
import classification.PaymentClassification;
import database.PayrollDatabase;
import schedule.PaymentSchedule;

public abstract class AddEmployeeTransaction extends Transaction {
	private int empid;
	private String name;
	private String address;

	public AddEmployeeTransaction(int empid, String name, String address,
			PayrollDatabase database) {
		super(database);
		this.empid = empid;
		this.name = name;
		this.address = address;
	}

	protected abstract PaymentClassification makeClassification();

	protected abstract PaymentSchedule makeSchedule();

	@Override
	public void execute() {
		PaymentClassification pc = makeClassification();
		PaymentSchedule ps = makeSchedule();
		PaymentMethod pm = new HoldMethod();

		Employee e = new Employee(empid, name, address);
		e.setClassification(pc);
		e.setSchedule(ps);
		e.setMethod(pm);
		database.addEmployee(e);
	}

	public String ToString() {
		return "id: " + empid + " name: " + name + " address: " + address;
	}
}
